using System;
using System.Globalization;
using System.Windows.Data;

namespace CPlatePrintSys.Application.Converters
{
    /// <summary>
    /// 将布尔值转换为文本的转换器
    /// </summary>
    public class BooleanToTextConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool boolValue)
            {
                return boolValue ? "是" : "否";
            }
            return "否";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is string stringValue)
            {
                return stringValue.Equals("是", StringComparison.OrdinalIgnoreCase);
            }
            return false;
        }
    }
} 